#include <my_global.h>
#include <mysql.h>
#include <ctype.h>

int main(int argc, char **argv)
{

  MYSQL *conn;
  MYSQL_RES *result;
  MYSQL_ROW row;
  int num_fields;
  int i;

  conn = mysql_init(NULL);
  mysql_real_connect(conn, "localhost", "root", "root123", "netbook", 0, NULL, 0);

  mysql_query(conn, "SELECT id FROM user");
  result = mysql_store_result(conn);

  num_fields = mysql_num_fields(result);

  printf("%s\n",result->data);
  while ((row = mysql_fetch_row(result)))
  {
      for(i = 0; i < num_fields; i++)
      {
          printf("%d\t\t", row[i] ? atoi(row[i]) : 0);
      }
      printf("\n");
  }

  mysql_free_result(result);
  mysql_close(conn);

}

